Skip to content

Validate containers before showing success message in start.sh#28

Merged
drneox merged 3 commits intomainfrom
copilot/fix-27
Aug 22, 2025
Merged

Validate containers before showing success message in start.sh#28
drneox merged 3 commits intomainfrom
copilot/fix-27

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Aug 20, 2025

The start.sh script was showing the "TZU IS RUNNING!" success message immediately after executing docker-compose up -d, without checking if all containers had actually started successfully. This could be misleading if any service failed during startup, leaving users with a false impression that the system was working when containers had actually crashed or failed to build.

Changes Made

Container Status Validation

Added check_container_status() function that:

  • Waits up to 30 attempts (150 seconds total) for all containers to reach running state
  • Validates all 4 expected services: postgresql, backend, frontend, nginx
  • Handles multiple Docker Compose status formats ("running", "Up X minutes", "Up X seconds (healthy)", etc.)
  • Provides specific error messages indicating exactly which services failed and their status

Health Check Validation

Added check_health_status() function that:

  • Checks health status for services with configured healthchecks (PostgreSQL)
  • Provides informative warnings about health status
  • Doesn't fail startup for health issues (containers may still be initializing)

Error Handling & User Experience

  • Clear error messages show which specific containers failed and why
  • Helpful troubleshooting commands provided when validation fails:
    💡 Try running: cd docker && docker compose logs
    💡 Or check individual container status: cd docker && docker compose ps
  • Script exits with error code 1 when validation fails, preventing misleading success messages

Backward Compatibility

  • Preserves all existing functionality and output formatting
  • Compatible with existing Docker Compose command detection (docker-compose vs docker compose)
  • No changes to success flow when all containers start properly

Before vs After

Before:

🔧 Starting services...
[containers fail to build]
⏳ Waiting for system initialization...
🎉 TZU IS RUNNING!  # Misleading - nothing is actually running

After:

🔧 Starting services... 
[containers fail to build]
⏳ Waiting for system initialization...
⏳ Waiting for containers to start...
❌ Container validation failed after 30 attempts
❌ Failed services: postgresql(not_found) backend(not_found) frontend(not_found) nginx(not_found)
❌ Failed to start all containers properly
💡 Try running: cd docker && docker compose logs

This ensures users get accurate feedback about the actual state of their TZU deployment and clear guidance on how to troubleshoot issues.

Fixes #27.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: drneox <1235287+drneox@users.noreply.github.com>
Copilot AI changed the title [WIP] Validate containers before showing success message Validate containers before showing success message in start.sh Aug 20, 2025
Copilot AI requested a review from drneox August 20, 2025 16:56
@drneox drneox marked this pull request as ready for review August 22, 2025 07:48
@drneox drneox merged commit b3cd566 into main Aug 22, 2025
4 checks passed
@drneox drneox deleted the copilot/fix-27 branch August 22, 2025 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Validate containers before showing success message

2 participants